PREP2 algorithm